<?php
include("include/conn.php");
require('include/Smarty/libs/Smarty.class.php');
$billNum  = 1;
if(isset($_POST['insertBtn']))
{
  $insertQueryjavakvoucher = "INSERT INTO javakvoucherom (billNo,date,partyName,silverKg,dagina)
                               VALUE ('".$_POST['billNo']."','".$_POST['dateYear']."-".$_POST['dateMonth']."-".$_POST['dateDay']."','".$_POST['partyName']."',
                                      '".$_POST['silverKg']."','".$_POST['dagina']."')";
  $insertQueryjavakvoucherRes = mysql_query($insertQueryjavakvoucher);
  if(!$insertQueryjavakvoucherRes)
    die("Insert Query Not Inserted : ".mysql_error());
  else
  {
    header("Location: javakVoucherListOm.php");
  }
}
// This for select billBook No. : Start
$selectBillNo = "SELECT billNo 
                   FROM javakvoucherom
               ORDER BY javakvoucherId DESC";
$selectBillNoRes = mysql_query($selectBillNo);
if($billNoRow = mysql_fetch_assoc($selectBillNoRes))
  if($billNoRow['billNo'] == 100)
    $billNum = 1;
  else
    $billNum = (int)$billNoRow['billNo'] + 1;
// This for select billBook No. : End
$smarty = new Smarty;
require("bottom.php");
$smarty->assign("billNum",$billNum);
$smarty->display("javakVoucherOm.tpl");
?>
